<?php
/*
 * СПВ
 **/
 class SP_Form_Hours extends SP_Form_Select
{
	protected $with_null;
	protected $from = 0;
	protected $to = 23;
	protected $step = 1;
	
	public function __construct($attr=null)
	{
		parent::__construct($attr);
		$this->multiple=false;
		if( $this->with_null ) $this->options['null']=$this->with_null;
		$i=$this->from;
		for($i; $i<=$this->to; $i+=$this->step)
		{
			$this->options[$i]=sprintf("%02d", $i);
		}
		
	}
	
	public function getValue()
	{
		$value=parent::getValue();
		if( $value=='null' ) $value=null;
		return $value;
	}
}